<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
        <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<base href="<%=basePath %>" />
    <link rel="stylesheet" type="text/css" href="jquery-easyui-1.4.1/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="css/icon.css">
    <link rel="stylesheet" type="text/css" href="jquery-easyui-1.4.1/themes/color.css">
	<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
	<script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
<title>项目收纳</title>
</head>
<body>
	<div style="height: 70px; width: 100%;">
		<div style="float: left; padding:20px 0 0 20px; ">   
		        <label for="">项目名称:</label>   
		        <input class="easyui-textbox" type="text" name="projectTitle" id="projectTitle"  />   
    	</div> 
    	<div style="float: left; padding:20px 0 0 20px; ">    
    		<button  id="search" class="easyui-linkbutton c1" data-options="iconCls:'icon-search'" type="button">查询 </button>
   		  </div> 
	      <div style="float: left; padding:20px 0 0 20px; ">    
	    	<button  id="reset" class="easyui-linkbutton c5" data-options="iconCls:'icon-no'" type="button">重置 </button>
	      </div> 
	</div>
	<div id="money_table"></div>
</body>
<script type="text/javascript">
$(function(){
	   $('#money_table')
		.datagrid(
				{
					url : 'admin/queryIncomeByPrijectTitle.do?pageSize=10',
					collapsible : true,
					width : '100%',
					height :'450px',
					iconCls : 'icon-user',
					fitColumns : true,
					pagination : true,
					rownumbers : true,
					singleSelect:true,
					checkOnSelect:false,
					selectOnCheck:false,
					idField:'loanid',
					loadMsg:'正在加载数据',
					loadFilter:function(data){
						 return data;
					},
					onClickRow: function(rowIndex, rowData) {
						//layer.msg("选中");
						
					},
					onDblClickRow :function(rowIndex,rowData){
						//layer.msg("double click");
					  },
					columns : [ [
							{
								field : 'projectTitle',
								title : '项目名',
								width : 50,
								align : 'center'
							},
							{
								field : 'alipayIncome',
								title : '支付宝收入',
								width : 50,
								align : 'center'
							},
							{
								field : 'wxIncome',
								title : '微信收入',
								width : 50,
								align : 'center'
							}, 
							{
								field : 'total',
								title : '总收入',
								width : 50,
								align : 'center'
							}
						   ] ]
				});
	 //设置分页控件  
		
	var p = $('#money_table').datagrid('getPager');
		$(p).pagination({
			pageSize : 10,//每页显示的记录条数，默认为10  
			pageList : [ 5, 10, 20, 30, 40, 50 ],//可以设置每页记录条数的列表  
			beforePageText : '第',//页数文本框前显示的汉字  
			afterPageText : '页    共 {pages} 页',
			displayMsg : '当前显示 {from} - {to} 条记录   共 {total} 条记录',
			onSelectPage : function(pageNumber, pageSize) {
				//layer.msg("pageNumber="+pageNumber+"pageSize="+pageSize)
				var datas = {
					projectTitle:$('#projectTitle').textbox('getValue'),
					currentPage : (pageNumber - 1) * pageSize,
					pageSize : pageSize
				}
				loadAddressData(datas);
			},
			onRefresh : function(pageNumber, pageSize) {
				var datas = {
						projectTitle:$('#projectTitle').textbox('getValue'),
						currentPage : (pageNumber - 1) * pageSize,
						pageSize : pageSize
					}
				loadAddressData(datas);
			}
		});
	});
	//search btn 
	$(function(){
		$("#search").click(function(){
			var pageSize=$('#money_table').datagrid('getPager').data("pagination").options.pageSize;
			var datas={
					projectTitle:$('#projectTitle').textbox('getValue'),
					pageSize:pageSize
			}
			loadAddressData(datas);
		});
	});
	//reset btn
	$(function(){
		$("#reset").click(function(){
			var pageSize=$('#money_table').datagrid('getPager').data("pagination").options.pageSize;
			$('#projectTitle').textbox('setValue','');
			var datas={
					pageSize : pageSize,
			}
			loadAddressData(datas);
		});
	});
	//loading data
	var loadAddressData=function(datas){
		 $.ajax({
				url : 'admin/queryIncomeByPrijectTitle.do',
				type : "POST",
				dataType : "json",						
				data : datas,
				success : function(param) {
						$('#money_table').datagrid('loadData',param);
				}
		});  
	}
</script>
</html>